Useful macros
Casting spells no longer requires the (Rank x). So you can now have a macro that says: /cast Holy Light, and it'll cast your highest rank of Holy Light. This macro will always cast the highest rank spell, and you will not be able to cast it on lower-level targets. =Spells= Self Cast Any Spell (without losing your target) /script TargetUnit("player");CastSpellByName('Holy Light');TargetLastTarget(); Just a quick spell for dueling Hunters if you are Shaman: /cast cure poison /script TargetByName("player"); Selfcasting non-enemy spells Some spells can not be cast on enemies. Thus, if you have an enemy targeted, you can cast them on yourself. Example This macro will only cast the spell if it can be cast on you: /script if ( not UnitIsFriend("player", "target") ) then CastSpellByName("Spell"); end /script if ( SpellIsTargeting() ) then SpellTargetUnit("player"); end Casting Buffs Adapted from the above code, this is designed to cast buffs. If an enemy is selected, you will cast the buff on yourself, if nothing is selected, you will cast the buff on yourself, if you are selected, you will cast the buff on yourself but if your ally is selected they will be buffed. Example This macro will cast buffs on you unless an ally is selected (Mark of the Wild): /script if (UnitIsFriend("player", "target") ) then CastSpellByName("Mark of the Wild") else CastSpellByName("Mark of the Wild"); end /script if ( SpellIsTargeting() ) then SpellTargetUnit("player"); end Cast a spell based on target's class You'll need to target the person you want to buff first. Here's an example for a paladin to use; note that it should all be on one line: /script class = UnitClass("target"); if ( ( class "Rogue" ) or ( class "Warrior" ) ) then CastSpellByName("Blessing of Might"); else CastSpellByName("Blessing of Wisdom"); end Cast a spell based on target's level You'll need to target the person you want to buff first. Here's an example for a priest to use on an English language server. You have to alter the spell name according to the spell you want to cast; note that it should all be on one line: /script Pre="Power Word: Fortitude(Rank " Sp={1,2,14,26,38,50} if (UnitLevel("target") ~= nil and UnitIsFriend("player","target")) then for i=6,1,-1 do if (UnitLevel("target") >= Spi) then CastSpellByName(Pre..i..")") return end end end Cast a healing spell on nearby friends This will target all your nearby friendly player characters in turn and cast a heal on the first one it comes to with a health level that is below a certain percentage of maximum (in this example 70%). Repeated calls to the macro will step through all nearby friends needing heals until it targets you. The macro checks the health of up to 40 nearby friendly player characters. If a call to this macro casts no heal then neither nearby friendly player characters nor yourself have a health level below the threshold of 70% of maximum. /script for i=1,40 do TargetNearestFriend(); if UnitHealth("target")/UnitHealthMax("target") < 0.7 then if UnitIsPlayer("target") then CastSpellByName("Lesser Healing Wave") end end end; TargetLastEnemy(); Announcing spells and targets to your party Good for healing and crowd control spells. Example with a healing spell (Party member must be targeted first to make the party announcement work): /cast Healing Touch /party Healing %t in 3.5 seconds Cast a spell on party member based on his location in party This will target the "first" member of your party, cast a healing spell on him, then return you to your previous target. To use on 2nd member of party change "party1" to "party2". /script TargetUnit("party1") /cast Flash Heal /script TargetLastTarget() Cast multiple buffs with smart buff recoginition This script checks whether the target has a buff, if not you cast it, if so you cast a different buff. /script i=1;m=0;while(UnitBuff("target",i)~=nil) do if(strfind(UnitBuff("target",i),"Regeneration")~=nil) then m=1; end;i=i+1;end; c=CastSpellByName; if(m 1) then c("Mark of the Wild(Rank 10)");else c("Thorns(Rank 10)");end; Modify the spell names to change the buff. = Inventory/Items = Equip an item /script PickupContainerItem(bag, slot); bag goes from 0 to 4, and slot from 1 to 20 (depending on bag size). For more information, go to Item equipping to see how to use items from backpacks, etc., and information on how to prevent accidental vendoring of items due to macros. Quick Self-Bandage (by Domandred) /target Name /script UseContainerItem(#, #); /script TargetLastEnemy(); Use: Really nice macro for duels or 1v1 pvp. You can stun/fear your enemy, press this and it'll automatically bandage you without losing your target. Use a Bandage /script UseAction(ActionID, 0, 1); /script if( SpellIsTargeting() ) then SpellTargetUnit("player"); end Bandage must be placed in the action bar at the slot given by ActionID. ActionID is a number from 1 to 120. Slot1-ActionBar1 is ActionID1, Slot12 is ActionID12, Slot1-ActionBar2 is ActionID13 and so on up to Slot12 of ActionBar10. This will bandage your target, or yourself if your current target is not a friendly target. Here's a different version courtesy of post by Sarf on the forums. This one will always self-bandage, even if you have a friendly player targeted. It will also re-target your original target. Note that this must all be on one line, its just split up for readability: /script p="player";t="target";if(not UnitCanAttack(t, p))then ot=UnitName(t);TargetUnit(p); else ot=nil;end;UseAction(ActionID);if(SpellIsTargeting())then SpellTargetUnit(p); end if(ot) then TargetByName(ot);end Example {PLEASE PROVIDE AN ACTUAL SAMPLE/EXAMPLE TEXT STRING HERE} Following is another example of self bandaging that does not use scripting. THIS WILL WORK FOR COSMOS USERS ONLY. Shift-clicking on the bandage (or other item in inventory) while editing your macro will insert its name into your macro. Placing the "target" command after the "use" command maintains your primary target and also maintains your combo points for that target if you're a Rogue. /use Heavy Linen Bandage /target player Note: As of WoW UI version 1300, when you use the /target command use player not "player" to target yourself. Script command /target does NOT require Cosmos mod, but the /use command does. You may experience problems with the script above, because it uses non-standard commands. If you place your Heavy bandage in the second ActionBar slot 5 you can use this small macro to use the bandage on your self. This works regardless of whether Cosmos (or any other mod) is installed. /script TargetUnit("player"); /script UseAction(17); You have to use 17, because it is 2nd Actionbar and 5th slot ((2-1)*12+5=17). Reference ActionID's: Actionbar Slot number 1: 1 2 3 4 5 6 7 8 9 10 11 12 2: 13 14 15 16 17 18 19 20 21 22 23 24 3: 25 26 27 28 29 30 31 32 33 34 35 36 4: 37 38 39 40 41 42 43 44 45 46 47 48 5: 49 50 51 52 53 54 55 56 57 58 59 60 6: 61 62 63 64 65 66 67 68 69 70 71 72 Sharpen weapons with stones (By Arag) /script UseContainerItem (#,#); /script PickupInventoryItem (16); Use: Simply press a button and use a Sharpening or Weightstone. Example: Press a button, sharpen your weapon. Change the 16 or 17 to do it for a secondary weapon. For the #'s on the first line, please refer to "Understanding Location" in section 6. = Interface = Switching Hotbars /script CURRENT_ACTIONBAR_PAGE = X; /script ChangeActionBarPage(); Where X is the Hotbar number Example /script CURRENT_ACTIONBAR_PAGE = 1; /script ChangeActionBarPage(); Macro Frame Toggling /script if ( not MacroFrame:IsVisible() ) then ShowUIPanel(MacroFrame); else HideUIPanel(MacroFrame); end; Set Video World Environment Variables Sometimes when you are in a high-traffic area (Ironforge or Orgrimmar in particular), RAM and processors get bogged down. One way to help your computer is to adjust the video settings to improve performance. You can put these macros into hotbars and bind to keys for easy switching, e.g. Shift-\, \, and Ctrl-\ for High, Medium, and Low Res. These don't change the actual resolution of the screen, only the level of detail. LowRes is very good for the Auction House / Bank areas. Also, if your UI needs reset (the rendering isn't working), just switch from one to another. HighRes: /z SetFarclip(777) /z SetWorldDetail(2) /z SetBaseMip(1) MediumRes: /z SetFarclip(477) /z SetWorldDetail(1) /z SetBaseMip(1) LowRes: /z SetFarclip(177) /z SetWorldDetail(0) /z SetBaseMip(0) Full-screen to windowed mode I found this handy for working on macros/scripts while having reference material next to me (ie these web pages and others ;). This will switch your game between full-screen, full-colour, and a smaller windowed mode. There are some assumptions, you need to replace the index numbers for your own setting - for me, I run WoW in 1600x1200 32bit full anti-aliasing when full-screen, 1024x768 16bit 1xanti-aliasing when in window. The index numbers can be calculated by going to video options and counting the items on the drop-down. Note: The bit between "/script" and "/console" must all be on one line (ie there should be a line starting "/script" and a line starting "/console" and that's it), it's broken up for readability. SwitchMode: /script currentRes = GetCurrentResolution(); if (currentRes 3) then SetScreenResolution(15); SetCVar("gxWindow", 0); SetMultisampleFormat(16); else SetCVar("gxWindow", 1); SetScreenResolution(3); SetMultisampleFormat(1); end; Replace the "15" in SetScreenResolution with your selected high-res index, the "16" in SetMultisampleFormat with your selected colour depth/anti-aliasing, and the "3" in Set/GetScreenResolution with your preferred windowed res. To finish this one off, drop it into a popup button and go to keybindings, link in "alt-enter". That way, alt-enter will alternate between windowed and full-screen. You can also work in any of the above Farclip etc calls to further alter the settings between windowed and full-screen, depending on how your machine behaves - experiment and see. Note also, I'm using GetCurrentResolution. I'd rather use GetCVar("gxWindow"), but I got very unreliable results from that - not sure why. Toggle Name Display I like to shut off player names when I take screenshots, so here is what I use: /script if ( GetCVar("UnitNamePlayer") "1" ) then SetCVar("UnitNamePlayer",0) else SetCVar("UnitNamePlayer",1) end And for shutting off the NPC names I use this: /script if ( GetCVar("UnitNameNPC") "1" ) then SetCVar("UnitNameNPC",0) else SetCVar("UnitNameNPC",1) end = Combat = Help Tank Character If you are in a group and fighting a larger group of enemies, and your group tank character is already fighting an enemy, you may not want to attack one which did not have Aggro yet. Select your group tank via key F and execute the following macro. /assist %t /script AttackTarget(); A more advanced method of this is to pre-select a player as the "main assist" and have your macro assist that player throughout the duration of the party. The simple method is to replace %t with the name of that player and edit your macro when needed. Main assist also works for everyday group play, but editing a macro and typing in a player's name may not be possible in all situations. If you are willing to sacrifice two macros and action bar slots, you can automate things with the following two macros: ---- Set Main Assist ---- /script LeaderPlayerName = UnitName("target") or UnitName("party1") or ""; /script DEFAULT_CHAT_FRAME:AddMessage("######## Set main assist to: " .. LeaderPlayerName); ---- Assist Main Assist Player ---- /script AssistByName(LeaderPlayerName or UnitName("party1") or UnitName("player")); /script DEFAULT_CHAT_FRAME:AddMessage("######## Assisting ".. LeaderPlayerName .. " with target " .. (UnitName("target") or "NO TARGET")); Use the "Set" macro when you have your main assist player selected and want to switch your assist macro to use that player. If no player is selected and you are in a party, the first other party member will be selected. If you are not in a party and not target is selected, you will assist yourself, which is somewhat redundant, but harmless. To save macro and action bar space, you can combine the two macros in the following script. To set the main assist player, hold down the control key while activating this macro. The version that fits into a 255 character macro is given below and it is somewhat obfuscated: ''/script p=PAsi or""u=UnitName;t="target"c=IsControlKeyDown()if©then p=u(t)or u("party1")or""else AssistByName(p)end;DEFAULT_CHAT_FRAME:AddMessage("######## "..(c and("Set assist: "..p)or("Assisting "..p.." with "..(u(t)or"NO TARGET"))))PAsi=p Here's the same script with extra spacing and punctuation added for clarity: ---- Main Assist Utility (Version 1.0.1 by Tiga) ---- /script p=PAsi or""; u=UnitName; t="target"; c=IsControlKeyDown(); if© then p=u(t) or u("party1") or "" else AssistByName(p) end; DEFAULT_CHAT_FRAME:AddMessage("######## ".. (c and ("Set assist: "..p) or ("Assisting "..p.." with "..(u(t) or "NO TARGET")))); PAsi=p; Target Memory The following macro memorizes players and mobs by name. Remembering mobs by name can be a problem if there are several with the exact same name in the area (you will often target the wrong mob). Because of this, this macro should only be used in PvP and when you are fighting a unique boss mob with unique sidekicks. * Hold down control to memorize a target. * To recall a memorized target, use the key without modifiers. * Hold down shift to cast a Polymorph spell on the memorized target. * Alt is ignored, so you can bind this to an alt key combination. To have multiple memorized targets, edit the Tg1 variable name in the three places where it is mentioned. Note that the short version below uses "ChatFrame1" instead of "DEFAULT_CHAT_FRAME" to save a few characters to allow for longer spell and skill names than Polymorph. The human-readable version is given below the compact/obfuscated version. ''/script t=Tg1 or""c=IsControlKeyDown()if©then t=UnitName("target")or""else TargetByName(t)if(IsShiftKeyDown())then CastSpellByName('Polymorph')end end ChatFrame1:AddMessage("######## "..(c and("Tg1 set to: "..t)or("Targeting: "..t)))Tg1=t Target Memory Utility (Version 1.0.1 by Tiga) ---- /script t=Tg1 or"" c=IsControlKeyDown() if© then t=UnitName("target")or"" else TargetByName(t) if(IsShiftKeyDown()) then CastSpellByName('Polymorph') end end DEFAULT_CHAT_FRAME:AddMessage("######## ".. (c and ("Tg1 set to: "..t) or ("Targeting: "..t))) Tg1=t Kill totems This can be used to destroy any totem, and is obviously designed for druids. Naturally you can change the last line to /shoot which is especially good for someone with a wand. Whether it will fit in the same macro or not, I'm not certain, but you might also want to add lines to target Dark Iron Dwarf mines as well. I can't think of anything else like it. The following is from Talashandy, cited by Alex http://www.cosmosui.org. /target Earthb /target Flameto /target Fire N /target Grace o /target Groundi /target Healing S /target Magm /target Mana /target Poiso /target Seari /target Sentr /target Stone /target Strength o /target Trem /target Wind /cast Moonfire(Rank 1) Here is a bit more programmy way of doing the same thing. /script un=UnitName; sf=strfind; t="target"; for i = 1,10,1 do TargetNearestEnemy() if (not UnitCanAttack("player",t))then break; end; if (sf(un(t),"Totem") or sf(un(t),"Ward ") or sf(un(t)," Ward")) then CastSpellByName("Shoot");break;end;end; = Pets = Pet Attack /script PetAttack(); A useful extension of this is to have your pet begin assisting your main tank with one button. You could also add a fourth line that casts one of your spells so that you begin fighting too. /target player /assist /script PetAttack(); Attack with Dash: (where Dash is the 4th icon on the pet bar) /script PetAttack(); CastPetAction(4); Pet Passive /script PetPassiveMode(); This is really useful in a Scatter Shot macro: /script PetPassiveMode(); /cast Scatter Shot = Class-specific = Druid ;Mark of the Wild to a target's level: /script r=7;l={1,10,20,30,40,50,60};if not UnitIsFriend("player","target")then TargetUnit("player");end;t=UnitLevel("target");for i=r,1,-1 do if (t>=li-10) then CastSpellByName("Mark of the Wild(Rank "..i..")");break;end;end ;Nature's Swiftness + Healing Touch - without global cooldown: /cast Nature's Swiftness /script SpellStopCasting(); /cast Healing Touch(Rank 10) /script if ( SpellIsTargeting() ) then SpellTargetUnit ("player"); end (NB: Use Healing Touch(Rank 9) and lower for lower ranks of the spell) Hunter Tab + Scattershot Rogues /script TargetNearestEnemy(); if (UnitClass("target") "rogue") then CastSpellByName("Scatter Shot"); CastSpellByName("Hunter's Mark (Rank 4)");end This macro will target the nearest enemy (equivalent to pushing tab), if the target is a rogue and he is in range it will cast Scattershot on him (The talent is required of course), if he is out of range it will cast Hunter's Mark on him. In addition if you push the button a second time after the target is affected by Scattershot it will cast Hunter's Mark on him. This macro comes in handy for those anoying situations when you know a rogue is around, if he decloaks when trying to cast an attack on you and you are spamming (clicking constantly) this macro, it will stop him in his tracks with scattershot and will ensure he does not cloak again with hunter's mark. I have this macro bound to my ` key (above tab) and it comes in handy when pvping. Raptor Strike + Wing Clip /cast Raptor Strike /cast Wing Clip Very simple macro that allows you to queue a Raptor Strike for your next normal melee swing and also use Wing Clip. Acts a little funny if you use it while out of melee range though. If your Raptor Strike is on cooldown, this can also be used to Wing Clip alone. If you think it won't work because it's two skills in one macro, try it. It works because only one is an instant cast, and the other one is an next melee type attack. Hunter Pull A /cast Concussive Shot(); /script PetAttack(); Use: This is a macro I use for my pet, and I love it. It's great for solo. What it does is whenever you cast your Concussive shot (which activates Autoshoot), it'll send your pet to attack. Great for solo, because if your pet has the highest growl, you shouldn't get hit. Note: I used this macro on 3/22/06 and it resulted in my game locking up and crashing with every use. Hunter Pull B /cast Hunters Mark(Rank #); /script PetAttack(); /cast Autoshoot(); Use: This was created by NetherRelm, and also works very well. This will cast Hunter Mark on the enemy, and like mine, send your pet to attack and turn Autoshoot on. Note: This does not work for me, nor does any macro with more than a single cast command. This macro will execute the Hunter's Mark, and command the pet to attack, but it does not start shooting the ranged weapon. Instead, it generates a red error message in the middle of the screen that says, "Another action is in progress". My understanding is that this behavior is normal, and is intended to disrupt robot functions. Removing the Hunter's mark cast allows the weapon to fire normally. Rather than correcting the original entry, it seemed that an explanation of why it does not work would be more useful. /cast Auto Shot /cast Hunter's Mark /script PetAttack() The above currently works for me--my theory is that just like casting Raptor Strike and Wing Clip on the same button, it will work only if your instant cast (Hunter's Mark) comes after your normal attack (Auto Shot). Auto Feed Pet Macro: /cast Feed Pet /script PickupContainerItem (#,#) Use: When I played my hunter, I loved this macro. When you press this macro, it'll cast Feed pet on the PickupContainerItem. The way this works is that all you do is press it, and it'll automatically feed your pet the item in the bag/slot you specify. Example: You're too lazy to feed your pet, so you press a button and it's all done. Priest ;Shield to a target's level: /script r=10;l={6,12,18,24,30,36,42,48,54,60};if not UnitIsFriend("player","target")then TargetUnit("player");end;t=UnitLevel("target");for i=r,1,-1 do if (t>=li-10)then CastSpellByName("Power Word: Shield(Rank "..i..")");break;end;end; ;Renew to a target's level: /script r=9;l={8,14,20,26,32,38,44,50,56};if not UnitIsFriend("player","target")then TargetUnit("player");end;t=UnitLevel("target");for i=r,1,-1 do if (t>=li-10) then CastSpellByName("Renew(Rank "..i..")");break;end;end; ;Power Word: Fortitude to a target's level: /script r=6;l={1,12,24,36,48,60};if not UnitIsFriend("player","target")then TargetUnit("player");end;t=UnitLevel("target");for i=r,1,-1 do if (t>=li-10) then CastSpellByName("Power Word: Fortitude(Rank "..i..")");break;end;end ;Shadow Protection to a unit's level (if possible): /script r=3;l={30,42,56};if not UnitIsFriend("player","target")then TargetUnit("player");end;t=UnitLevel("target");for i=r,1,-1 do if (t>=li-10) then CastSpellByName("Shadow Protection(Rank "..i..")");break;end;end ;Psychic Scream for Undead Priests: I use this macro on my Undead priest, although it may be applicable for other races as well. It makes using Psychic Scream just that little bit more fun. /say Boo! /cast Psychic Scream You may, of course, replace "Boo!" with something else such as "Booga booga!" or "Flee!" Paladin Autoselect Blessing /script power = UnitPowerType("target"); if ( power 0 ) then CastSpellByName("Blessing of Wisdom") else CastSpellByName("Blessing of Might") end; if ( SpellIsTargeting() ) then CastSpellByName("Blessing of Might"); TargetUnit("player"); end; Use: Auto-buff mana users with Blessing of Wisdom and others (including self) with Blessing of Might. Shaman Swift Heal /script local a=IsAltKeyDown();local c,d=GetSpellCooldown(157,0);if(c 0)then CastSpell(157,0) else if(a)then TargetUnit("player") end;if(d 0.001)then CastSpell(146,0) else CastSpell(152,0) end;if(a)then TargetLastTarget() end;end 1. I created this macro to simplify casting Nature's Swiftness and a Healing Wave spell. It has the following behavour: 2. If Nature's Swiftness is not on cooldown cast it. 3. If Nature's Swiftness is active on you then cast Healing Wave (Rank 9) on your selected target. 4. Otherwise cast Lesser Healing Wave (Rank 6) on your target. If you hold the Alt key then the healing spell will be cast on yourself. Note: Since it uses spell numbers to track cooldowns and cast spells it needs to be tuned to a character's Spell Book. This macro will search your spell book for the Nature's Swiftness spell and tell you it's spell number: /script local i=1;local j;while 1 do local n,r=GetSpellName(i,0);if not n then do break end elseif n "Nature's Swiftness" then j=i-157;_ERRORMESSAGE("Nature's Swiftness is spell number "..i.." modify spell numbers by "..j) end;i=i+1;end Running this macro will display a dialogue box that will tell you how much to modify the spell numbers in the first macro by to get it to work for you. With some tweaking of spell numbers this script can be made to insta-cast any spell and should also be of some use to Druids. It's not most-used yet, but hopefully it will be. --Brahgulshin 19:26, 13 March 2006 (EST) Warlock fears, pet stays /cast Fear(Rank #) /script PetFollow(); Use: Warlock cast fear, and pet quits attacking. Good to prevent your pet from messing your fear up. Pets Pet Attack /script PetAttack(); Use: Sends your pet to attack. Best used with a hunter's shot skill. Pet's Target /script TargetUnitsPet("Player"); Use: Targets what your pet is targeting. = Miscellaneous = Local Server time /script hour,min=GetGameTime() /script DEFAULT_CHAT_FRAME:AddMessage(format("Server time is %s:%s",hour,min)); Location /script px,py=GetPlayerMapPosition("player") /script DEFAULT_CHAT_FRAME:AddMessage(format("[ %s ] %s , %s",GetZoneText(),px,py)); ''Value will be between 0,0 (Top Left corner of current map) and 1,1 (Bottom Right) ''A variant that gives a value between 0 and 100, and reduces it to 1 decimal place: /script px,py=GetPlayerMapPosition("player") /script px=floor(px*1000) /script py=floor(py*1000) /script px=px/10 /script py=py/10 /script DEFAULT_CHAT_FRAME:AddMessage(format("%s: %s, %s",GetZoneText(),px,py)); Change Action Bar Page /script CURRENT_ACTIONBAR_PAGE = X; /script ChangeActionBarPage(); Use: Replace "X" with the action bar page number, and by pressing this, it'll automatically change. Example: You have two of these, both set on the "=" on page 1 and 2, and have page 1's set to change to page 2, and vise virsa. When ever you press "=", it'll toggle between page 1 and 2. ---- Go to Macros Go to Interface Customization Category:Interface Customization